package com.changgou.page.service.impl;

import com.changgou.page.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;

import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Map;

@Service
public class PageServiceImpl implements PageService {
    @Autowired
    TemplateEngine templateEngine;
    @Override
    public void generateHtml(String spuId) {

        Context context = new Context();
        Map<String, Object> itemData=getItemData();
        try {
            Writer out=new PrintWriter("");
            templateEngine.process("item", context,out);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return;
    }

    private Map<String, Object> getItemData() {
        return null;
    }
}
